#ifndef ENEMY_H
#define ENEMY_H
#include "player.h"
#include "../affiliate/spriteAnima.h"
class enemy : public actor{
    enum state{
        NORMAL,
        HURT,
        DIE
    };
    state state_ = NORMAL;
    player* target_ = nullptr;
    spriteAnima* normal = nullptr;
    spriteAnima* hurt   = nullptr;
    spriteAnima* die    = nullptr;
    spriteAnima* current = nullptr;
    float time = 0.0f;
    int score_ = 10;
public:
    virtual void init() override;
    virtual void update(float dt) override;
    static enemy* createEnemy(node* parent, glm::vec2 pos, player *target);
    void aim_target(player* target);
    player* get_target(){ return target_; };
    void set_target(player* target){ target_ = target; };
    void checkState();
    void changeState(state newState = NORMAL);
    state getState(){ return state_; };
    spriteAnima* getNormal(){ return normal; };
    spriteAnima* getHurt(){ return hurt; };
    spriteAnima* getDie(){ return die; };
    spriteAnima* getCurrent(){ return current; };
    void remove();
    void attack();
};

#endif // ENEMY_H